package com.tjetc.dao;

import com.tjetc.domain.AdoptionApplication;
import com.tjetc.domain.Animal;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AdoptApplicationMapper {
    @Select("select * from animal where id=#{id} and status=0;")
    public Animal getById(int id);

    @Insert("insert into adoption_application(adopter_id, animal_id, application_time, status)values " +
            "(#{adopterId},#{animalId},#{applicationTime},#{status})")
    int addApplication(AdoptionApplication application);

    @Select("select * from adoption_application where adopter_id=#{id};")
    List<AdoptionApplication> listApplication(int id);

    @Select("select * from adoption_application where status=0")
    List<AdoptionApplication> list();

    @Select("select * from adoption_application where id=#{id} and status=0;")
    AdoptionApplication getApprovalById(int id);

    int update(AdoptionApplication application);
}
